package com.ynny.project01.controller;

import com.ynny.project01.common.AjaxResult;
import com.ynny.project01.entity.UserDTO;
import com.ynny.project01.service.UserServiceImpl;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//@Controller
//@ResponseBody   // 所有方法 返回JSON数据格式
@RestController
@RequestMapping("/user")
@CrossOrigin // 允许跨域访问
public class UserController {

    @Autowired
    UserServiceImpl userService;

    //@Valid // 参数校验
    @PostMapping("/edit")
    public AjaxResult edit(@Valid @RequestBody UserDTO user){

        System.out.println("123456789");
        userService.edit(user);
        return AjaxResult.ok();
    }


}